package com.education.platform.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.education.platform.entity.Appointment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 预约Mapper接口
 *
 * @author education-platform
 * @since 2024-09-27
 */
@Mapper
public interface AppointmentMapper extends BaseMapper<Appointment> {

    /**
     * 分页查询预约列表（带用户信息）
     */
    IPage<Appointment> selectAppointmentPageWithUser(Page<Appointment> page, @Param("parentId") Long parentId, 
                                                    @Param("teacherId") Long teacherId, @Param("status") String status);

    /**
     * 根据家长ID查询预约列表
     */
    List<Appointment> selectByParentId(@Param("parentId") Long parentId);

    /**
     * 根据教员ID查询预约列表
     */
    List<Appointment> selectByTeacherId(@Param("teacherId") Long teacherId);

    /**
     * 查询待处理的预约
     */
    List<Appointment> selectPendingAppointments(@Param("teacherId") Long teacherId);

    /**
     * 统计预约数量
     */
    Integer countByStatus(@Param("status") String status);
} 